﻿using UnityEngine;
using System.Collections;

public class kuangjin : GameBehaviour{
	public GameObject gouzi;
	bool IsMove=false;
	public float Holdspeed=0.002f;
	// Use this for initialization
	void Start () 
	{

	}
	void OnTriggerEnter2D(Collider2D other)
	{
		if (other.GetComponent<gouzi>()!=null)
		{
			IsMove=true;
			Game.instance.Nonespeed=this.Holdspeed;
			Game.instance.Dragobject=this.gameObject;
		}
	}
	// Update is called once per frame
	public override void GameUpdate()
	{    
		if (IsMove) 
		{
			this.transform.position = gouzi.transform.position;
			if(Game.instance.GameState==state.XUANZHUAN)
			{
				Game.instance.Nonespeed=0.01f;
				Game.instance.source+=100;
				Game.instance.showsource();
				Destroy(this.gameObject);
				//PlayerPrefs.
			}
		}


	}
}
